﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

namespace KZ.Express.DAL
{
    public class PriceListDAL : DataAccessBase
    {
        /// <summary>
        /// Select original price list
        /// </summary>
        /// <param name="carrierID"></param>
        /// <param name="supplierID"></param>
        /// <returns></returns>
        public DataTable SelectOriginalPriceList(int carrierID, int supplierID, DateTime date)
        {
            List<SqlParameter> parameters = new List<SqlParameter>();
            parameters.Add(new SqlParameter("CarrierID", carrierID));
            parameters.Add(new SqlParameter("SupplierID", supplierID));
            parameters.Add(new SqlParameter("Date", date));

            return _helper.ExecuteQuery("proc_PriceList_SelectOriginal", parameters.ToArray());
        }

        /// <summary>
        /// Select customer price list
        /// </summary>
        /// <param name="carrierID"></param>
        /// <param name="supplierID"></param>
        /// <returns></returns>
        public DataTable SelectCustomerPriceList(int carrierID, int supplierID, int customerID, DateTime date)
        {
            List<SqlParameter> parameters = new List<SqlParameter>();
            parameters.Add(new SqlParameter("CarrierID", carrierID));
            parameters.Add(new SqlParameter("SupplierID", supplierID));
            parameters.Add(new SqlParameter("CustomerID", customerID));
            parameters.Add(new SqlParameter("Date", date));            

            return _helper.ExecuteQuery("proc_PriceList_SelectCustomer", parameters.ToArray());
        }
    }
}